package com.eco.fanliapp.service;

import com.eco.fanliapp.entity.SysLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Slf4j
public class SysLogCommon {

    @Autowired
    private ISysLogService iSysLogService;

    @Async
    public void save(SysLog sysLog){

        try {
            sysLog.setUserType(2);
            sysLog.setCreatTime(new Date());
            sysLog.setUpdateTime(new Date());
            sysLog.setLogType(1);
            iSysLogService.addSysLog(sysLog);
        }catch (Exception e){
            e.printStackTrace();
            log.info("插入操作日志失败");
        }
    }
}
